1. Field of the Invention
Apparatuses and methods consistent with the present invention generally relate to video encoding and decoding, and more particularly, to video encoding and decoding in which a current block can be accurately predicted using weighted prediction and an image is encoded and decoded based on the prediction result.
2. Description of the Related Art
In video compression standards such as Moving Picture Experts Group (MPEG-1), MPEG-2, and H.264/MPEG-4 Advanced Video Coding (AVC), a picture is divided into macroblocks for video encoding. Each of the macroblocks is then encoded using interprediction or intraprediction.
Video encoding using interprediction involves video compression by means of removal of temporal redundancy between pictures and a representative example thereof is motion estimation encoding. In motion estimation encoding, motion of a current picture is estimated and compensated for in block units using at least one reference picture for video encoding.
In motion estimation encoding, a block that is most similar to the current block is searched for in a predetermined search range of at least one reference picture using a predetermined evaluation function. Once the similar block is found, only a residual block between the current block and the found block is transmitted, thereby improving the data compression rate. Blocks of various sizes such as 16×16, 8×16, 8×8, or the like can be used in motion estimation encoding.
For interprediction, H.264/AVC provides a prediction mode called weighted prediction. This prediction mode is usually used to predict the brightness of an image. For an image whose brightness changes over time such as when the image fades in or fades out, image encoding having no consideration regarding the brightness of the image may lead to significant degradation in the display quality of the image. Thus, H.264/AVC provides a method of performing prediction by adaptively weighting a reference picture.
FIG. 1 illustrates an example of weighted prediction according to the related art.
Referring to FIG. 1, it is assumed that a current picture 110 is a bidirectional (B) picture and is interpredicted using two reference pictures #0 120 and #1 130. To predict a current block 112 included in the current picture 110, two reference blocks 122 and 132 corresponding to the current block 112 are selected from the reference pictures 120 and 130, respectively. A block that is most similar to the current block 112 is selected using a predetermined evaluation function.
Two motion vectors MV0 and MV1 are estimated for interprediction of the current block 112. The current block 112 is then predicted using weighted prediction.
Weights are calculated based on temporal distances between the current picture 110 and the reference pictures 120 and 130. A weight W1 assigned to the reference picture 130 is calculated by W1=tb/td, where tb is the temporal distance between the reference picture 120 and the current picture 110, and td is the temporal distance between the reference picture 120 and the reference picture 130. A weight W0 assigned to the reference picture 120 is calculated by W0=1−W1.
Once the weights are assigned to the reference pictures 120 and 130, a prediction block P of the current block 112 is obtained by P=W0*R0+W1*R1+D. R0 indicates the reference block 122 corresponding to the current block 112, which is included in the reference picture 120, R1 indicates the reference block 132 corresponding to the current block 112, which is included in the reference picture 130, and D is an offset that may be ‘0’.
When the weights are calculated based on temporal distances between the current picture 110 and the reference pictures 120 and 130 as illustrated in FIG. 1, it is not necessary to separately encode the weights used in prediction of the current block 112, which is called an implicit mode. On the other hand, when the weights are set at random instead of being calculated based on the temporal distances, the weights used in prediction of the current block 112 have to be separately encoded, which is called an explicit mode.
In weighted prediction illustrated in FIG. 1, however, since the particular weights W0 and W1 are assigned for the reference blocks 122 and 132, the accuracy of predicting each block included in the current picture 110 degrades.